<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/11/21
 * Time: 9:24
 */
namespace phpfuntions\mp_preg;
class myphp_preg
{
    /**
     * preg_grep 函数 ：返回与模式匹配的数组单元
     * @access public
     * @return
     */
    public static function preg_grep ($pattern, array $input, $flags = 0 ) {
        return preg_grep(  $pattern,  $input, $flags );

    }
    /**
     * preg_match_all 函数 ：进行全局正则表达式匹配
     * @access public
     * @return
     */
    public static function preg_match_all ($pattern, $subject, array &$matches = null, $flags = PREG_PATTERN_ORDER, $offset = 0 ) {
        return preg_match_all( $pattern, $subject, $matches , $flags , $offset );

    }
    /**
     * preg_match 函数 ：进行正则表达式匹配
     * @access public
     * @return
     */
    public static function preg_match ($pattern, $subject, array &$matches = null, $flags = 0, $offset = 0 ) {
        return preg_match( $pattern, $subject,  $matches , $flags, $offset );

    }
    /**
     * preg_quote 函数 ：转义正则表达式字符
     * @access public
     * @return
     */
    public static function preg_quote ( $str, $delimiter = null) {
        return preg_quote(  $str, $delimiter  );

    }
    /**
     * preg_replace_callback 函数 ：用回调 函数 执行正则表达式的查找和替换
     * @access public
     * @return
     */
    public static function preg_replace_callback ($pattern, callable $callback, $subject, $limit = -1, &$count = null ) {
        return preg_replace_callback(  $pattern,  $callback, $subject, $limit , $count  );

    }
    /**
     * preg_replace 函数 ：执行正则表达式的查找和替换
     * @access public
     * @return
     */
    public static function preg_replace ( $pattern, $replacement, $subject, $limit = -1, &$count = null) {
        return preg_replace(  $pattern, $replacement, $subject, $limit = -1, $count );

    }

    /**
     * preg_split 函数 ：用正则表达式分割字符串
     * @access public
     * @return
     */
    public static function hash_update_file ( $hcontext, $filename, $scontext = null) {
        return hash_update_file( $hcontext, $filename, $scontext   );

    }
}